package classes;

import java.util.ArrayList;

public class Subject {

	private int subjectID;
	private String subjectName;
	private String syllabusURL;
	private ArrayList<String> subjectLectors = new ArrayList<String>();

	public Subject(int subjectID, String subjectName, String syllabusURL) {
		this.subjectID = subjectID;
		this.subjectName = subjectName;
		this.syllabusURL = syllabusURL;
	}

	public int getSubjectId() {
		return subjectID;
	}

	public void setSubjectId(int subjectID) {
		this.subjectID = subjectID;
		SubjectManager.updateSomethingInt(subjectID, "subject_id", subjectID);
	}

	public void setSubjectName(String subjectName) {
		this.subjectName = subjectName;
		SubjectManager.updateSomethingString(subjectID, "subject_name", subjectName);
	}

	public void setSyllabusUrl(String syllabusURL) {
		this.syllabusURL = syllabusURL;
		SubjectManager.setSyllabusUrl(subjectID, syllabusURL);
	}

	public String getSubjectName() {
		return subjectName;
	}

	public String getSyllabusUrl() {
		return syllabusURL;
	}
	
	public ArrayList<String> getLecturers(){
		return subjectLectors;
	}
	public void addLecturer(String username){
		subjectLectors.add(username);
		SubjectManager.addLecturersToSubject(subjectID, username);
	}
	
	public void addLecturerFromSubjectManager(String username){
		subjectLectors.add(username);
	}
	
	public void removeLecturer(String username){
		subjectLectors.remove(username);
		SubjectManager.deleteLecturerFromSubject(subjectID, username);
	}
	
	@Override
	public String toString() {
		return "subject_id = " + getSubjectId() + " subject_name = " + getSubjectName() + " syllabus_url = " + getSyllabusUrl();
	}
	

}
